package com.controller.company;


import com.dao.EditDao;
import com.dao.ResumeDao;
import com.dao.imp.EditDaoimpl;
import com.dao.imp.ResumeDaoImpl;
import com.entity.Job;
import com.entity.Resume;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/EditResumeState")
public class EditResumeState extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String auditState = req.getParameter("auditState");
        String opinion = req.getParameter("opinion");
        int auditId = Integer.parseInt(req.getParameter("auditId"));
        System.out.println("auditState = " + auditState);


//        Job job = new Job();
        Resume resume = new Resume();
        resume.setAuditId(auditId);
        resume.setAuditState(auditState);
        resume.setOpinion(opinion);

        EditDao editDao  = new EditDaoimpl();

//        ResumeDao resumeDao = new ResumeDaoImpl();
        int i =editDao.EditResumeState(resume);
        System.out.println("EditResumeState-i = " + i);
        if(i==1){
            resp.getWriter().write("success");
        }else{
            resp.getWriter().write("fail");
        }

    }
}
